package com.uuei.spring;

import com.uuei.spring.bean.Cat;
import com.uuei.spring.bean.Person;
import com.uuei.spring.config.MainConfig;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

public class AnnotationMainTest {
	public static void main(String[] args) {
		ApplicationContext applicationContext = new AnnotationConfigApplicationContext(MainConfig.class);
		//Person bean = applicationContext.getBean(Person.class);
		//System.out.println(bean);

		//String[] names = applicationContext.getBeanDefinitionNames();
		//for (String name : names) {
		//	System.out.println(name);
		//}

		//Person bean1 = applicationContext.getBean(Person.class);
		//Cat cat = bean1.getCat();
		//
		//Person bean2 = applicationContext.getBean(Person.class);
		//Cat cat1 = bean2.getCat();
		//
		//System.out.println(cat1 == cat);
		//System.out.println(cat);

		//Person bean = applicationContext.getBean(Person.class);
		//
		//
		//Cat cat = bean.getCat();
		//System.out.println(cat);
		//
		//ApplicationContext context = bean.getContext();
		//
		//System.out.println(context == applicationContext);

	}
}
